package screen;

import misc.*;
import fs.*;

import java.awt.*;
import java.util.*;
import java.awt.event.*;
import javax.swing.*;

public class VRAM extends JPanel {
    private ArrayList<String> content = new ArrayList<>();
    private static int MAX_SIZE = Props.screenHeight() / 23;
    public void paintComponent(Graphics g) {
        Graphics2D g2d = (Graphics2D) g;
        g2d.setBackground(Color.BLACK);
        g2d.setColor(Color.BLACK);
        g2d.fillRect(0, 0, Props.screenWidth(), Props.screenHeight());
        g2d.setPaint(Color.WHITE);
        for (int i = 0; i < content.size(); i++) {
            g2d.setFont(new Font("黑体", Font.PLAIN, 20));
            g2d.drawString(content.get(i), 0, 23 * i + 20);
        }
    }
    public void doAdd(String s) {
        content.add(s);
    }
    public void clear() {
        content.clear();
    }
    public void setElem(int i, String s) {
        content.set(i, s);
    }
    public String getElem(int i) {
        return content.get(i);
    }
    public int getMaxSize() {
        return VRAM.MAX_SIZE;
    }
    public int getCurrentSize() {
        return content.size();
    }
    public void doRemove(int ind) {
        content.remove(ind);
    }
}